const express = require('express')
const router = express.Router()
const api = require('./api')

// 获取商品数据
router.get('/api/getGoodsDate', (req, res) => {
    api.getGoodsDate(req, res)
})

// 登陆请求
router.post('/api/login', (req, res) => {
    api.login(req, res)
})


// 注册请求
router.post('/api/register', (req, res) => {
    api.register(req, res)
})


// 添加购物车
router.post('/api/addGoods', (req, res) => {
    api.addGoods(req, res)
})

// 获取购物车
router.get('/api/searchGoodsIntheCar', (req, res) => {
    api.searchGoodsIntheCar(req, res)
})


// 删除购物车商品
router.post('/api/reduceGoods', (req, res) => {
    api.reduceGoods(req, res)
})

// 获取详情页
router.get('/api/getGoodsDetails', (req, res) => {
    api.getGoodsDetails(req, res)
})

// 获取地址列表
router.get('/api/getLocationList', (req, res) => {
    api.getLocationList(req, res)
})


// 添加地址
router.post('/api/addAddress', (req, res) => {
    api.addAddress(req, res)
})


// 删除地址
router.post('/api/delAddress', (req, res) => {
    api.delAddress(req, res)
})


// 修改地址
router.post('/api/updateAddress', (req, res) => {
    api.updateAddress(req, res)
})

// 获取用户信息
router.get('/api/getUserInfo', (req, res) => {
    api.getUserInfo(req, res)
})

// 修改用户信息
router.post('/api/updateUserInfo', (req, res) => {
    api.updateUserInfo(req, res)
})


// 添加订单
router.post('/api/addOrder', (req, res) => {
    api.addOrder(req, res)
})


// 清空购物车
router.post('/api/removeCar',(req,res)=>{
    api.removeCar(req,res)
})


// 获取所有订单信息
router.get('/api/getOrder', (req, res) => {
    api.getOrder(req, res)
})


// 获取单个订单信息
router.get('/api/getOnesOrder', (req, res) => {
    api.getOnesOrder(req, res)
})

// 删除订单
router.post('/api/delOrder', (req, res) => {
    api.delOrder(req, res)
})

// 获取品牌商品信息
router.get('/api/getBrandGoods', (req, res) => {
    api.getBrandGoods(req, res)
})

module.exports = router